/**
 * Created with IntelliJ IDEA.
 * Description: 泛型之通配符的练习
 */

class Message<T> {
    private T message ;
    public T getMessage() {
        return message;
    }
    public void setMessage(T message) {
        this.message = message;
    }
}

class Food{
}

class Fruit extends Food{
}

class Apple extends Fruit{
}

public class Test2 {
    public static void main(String[] args) {

    }

    public static void fun2(Message<? super Fruit> temp) {
        temp.setMessage(new Apple());
    }

    public static void main1(String[] args) {
        Message<String> message = new Message() ;
        Message<Integer> message1 = new Message<>();
        message.setMessage("hello world!");
        message1.setMessage(5);
        fun(message);
        fun(message1);
    }
    public static void fun(Message<?> temp){
        System.out.println(temp.getMessage());
        //temp.setMessage(2);
    }

    /*public static void fun(Message<Integer> temp){
        System.out.println(temp.getMessage());
    }*/

}
